#include "system_path.h"
#include <iostream>

namespace fs = std::filesystem;

bool SystemPath::isAbsolutePath(const std::string &path)
{
    return fs::path(path).is_absolute();
}

bool SystemPath::isRelativePath(const std::string & path)
{
    return fs::path(path).is_relative();
}

bool SystemPath::isPathExist(const std::string &path)
{
    return fs::exists(fs::path(path));
}

bool SystemPath::isPathDirectory(const std::string &path)
{
    std::error_code ec;
    bool res = fs::is_directory(fs::path(path), ec);
    if (ec) {
        /* not directory */
        std::cout << "path \"" << path << "\" is not a directory" << std::endl;
    }
    return res;
}

bool SystemPath::isPathRegularFile(const std::string &path)
{
    std::error_code ec;
    bool res = fs::is_regular_file(fs::path(path), ec);
    if (ec) {
        /* not a regular file */
        std::cout << "path \"" << path << "\" is not a regular file" << std::endl;
    }
    return res;
}

